﻿using System;
using System.Collections.Generic;
using System.Windows;
using Ellanet.Classes;
using Ellanet.ViewModels;

namespace Ellanet.Windows
{
    public partial class TestWindow
    {
        public TestWindow(List<Sum> sums, TimeSpan interval)
        {
            InitializeComponent();
            var vm = new TestWindowViewModel(sums, interval);
            vm.RequestViewClose += vm_RequestViewClose;
            DataContext = vm;
        }

        private void vm_RequestViewClose()
        {
            Dispatcher.Invoke(delegate { DialogResult = true; });
            Dispatcher.Invoke(Close);
        }

        private void CloseButton_OnClick(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }
    }
}
